<?php
class LogController extends NodeController {
	
	public function listing() {
		$rs = self::getLogService ()->listing ( $_GET ['p'] );
		$this->view ()->assign ( 'num', $rs ['page'] );
		$this->view ()->assign ( 'log', $rs ['list'] );
		$this->view ()->display ( 'file:log/log.tpl' );
	}
	/**
	 * 最近30天的登录情况 图表显示
	 */
	public function login() {
		$days = isset ( $_GET ['days'] ) ? $_GET ['days'] : 30;
		$format = isset ( $_GET ['format'] ) ? $_GET ['format'] : "d";
		$rs = self::getLogService ()->getLoginStatus ( $format, $days );
		$this->view ()->assign ( 'keys', $rs ['keys'] );
		$this->view ()->assign ( 'values', $rs ['values'] );
		$this->view ()->display ( 'file:log/loginchart.tpl' );
	}
	
	public static function getLogService() {
		return new LogService ();
	}
}